<%@ page pageEncoding="utf-8" contentType="text/html" %>
<%@ page import="model.*" %>
<%
User u = (User) request.getAttribute("edit_user");
UserGroup[] usergroups = (UserGroup[]) request.getAttribute("usergroup[]");
%>
<%@ include file="header.tpl.jsp"%>

<form action="#" method="post">

<input type="hidden" id="uid" name="uid" value="<%=u.getUid()%>" />

<div class="box">
	<h2>编辑用户</h2>
	<table>
		<tr><th>用户名</th><td><input type="text" id="username" name="username" value="<%=u.getUsername()%>" /></td></tr>
		<tr><th>E-mail</th><td><input type="text" id="email" name="email" value="<%=u.getEmail()%>" readonly="readonly" /></td></tr>
		<tr><th>密码</th><td><input type="text" id="password" name="password" value="<%=u.getPassword()%>" /></td></tr>
		<tr>
			<th>用户组</th>
			<td>
				<select id="groupid" name="groupid">
				<%for(int i = 0; i < usergroups.length; i++){%>
					<option value="<%=usergroups[i].getGroupId()%>"<%if(usergroups[i].getGroupId() == u.getGroupId()){%> selected="selected" <%}%>><%=usergroups[i].getGroupName()%></option>
				<%}%>
				</select>
			</td>
		</tr>
	</table>
</div>

<div class="post_buttons">
	<button type="submit">完成编辑</button>
</div>

</form>

<%@ include file="footer.tpl.jsp"%>